import time

import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.IN)
GPIO.setup(21, GPIO.OUT)


def destroy():
    GPIO.output(21, GPIO.LOW)
    GPIO.cleanup()


def showResult():
    while True:
        input_result = GPIO.input(16)
        print(input_result)
        GPIO.output(21, input_result)
        time.sleep(0.1)


if __name__ == '__main__':
    try:
        showResult()
    except KeyboardInterrupt:
        destroy()
